package org.jivesoftware.smack.packet;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class Registration extends IQ
{
  private Map<String, String> attributes;
  private String instructions = null;

  public Registration()
  {
    this.attributes = new HashMap();
    this.instructions = null;
    this.attributes = null;
  }

  public void addAttribute(String paramString1, String paramString2)
  {
    this.attributes.put(paramString1, paramString2);
  }

  public Map<String, String> getAttributes()
  {
    return this.attributes;
  }

  public String getChildElementXML()
  {
    Iterator localIterator;
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<query xmlns=\"jabber:iq:register\">");
    if (this.instructions != null)
      localStringBuilder.append("<instructions>").append(this.instructions).append("</instructions>");
    if ((this.attributes != null) && (this.attributes.size() > 0))
      localIterator = this.attributes.keySet().iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
      {
        localStringBuilder.append(getExtensionsXML());
        localStringBuilder.append("</query>");
        return localStringBuilder.toString();
      }
      String str1 = (String)localIterator.next();
      String str2 = (String)this.attributes.get(str1);
      localStringBuilder.append("<").append(str1).append(">");
      localStringBuilder.append(str2);
      localStringBuilder.append("</").append(str1).append(">");
    }
  }

  public String getInstructions()
  {
    return this.instructions;
  }

  public void setAttributes(Map<String, String> paramMap)
  {
    this.attributes = paramMap;
  }

  public void setInstructions(String paramString)
  {
    this.instructions = paramString;
  }
}